package com.etu.jsonservices.model;

import java.io.Serializable;
import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

public class GenericService<T, PK extends Serializable>{

	private IGenericDAO<T, PK> dao;
		
	public GenericService(IGenericDAO<T, PK> dao){
		this.dao=dao;
	}
	
	
	public List<T> getAll() {
		return dao.getAll();
	}

	public List<T> getAllDistinct() {
		return dao.getAllDistinct();
	}


	public T get(PK id) {
		return dao.get(id);
	}


	public boolean exists(PK id) {
		return dao.exists(id);
	}


	public T saveOrUpdate(T object) {
		return dao.save(object);
	}


	public void delete(PK id) {
		dao.remove(id);
	}

}
